﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:JustinAngel.MindwaveSensor.WP8.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
	<!-- Resource dictionary entries should be defined here. -->

    <Style TargetType="local:MindwaveAttentionProgressBar">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MindwaveAttentionProgressBar">
                    <Grid >
                    	<Grid.RowDefinitions>
                    		<RowDefinition Height="55"/>
							<RowDefinition Height="30"/>
                    		<RowDefinition Height="31"/>
                    		<RowDefinition Height="76*" />
                    	</Grid.RowDefinitions>
                    	<Grid.ColumnDefinitions>
                    		<ColumnDefinition Width="70*"/>
                    		<ColumnDefinition Width="30*"/>
                    	</Grid.ColumnDefinitions>
                    	<VisualStateManager.VisualStateGroups>
                    		<VisualStateGroup x:Name="eSenseStates">
                    			<VisualState x:Name="On">
                    				<Storyboard>
                    					<ColorAnimation Duration="0" To="#FF5FAF4A" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/>
                    					<ColorAnimation Duration="0" To="#FF5FAF4A" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="progressBar" d:IsOptimized="True"/>
                    				</Storyboard>
                    			</VisualState>
                    			<VisualState x:Name="Off"/>
                    		</VisualStateGroup>
                    	</VisualStateManager.VisualStateGroups>
                    	<ProgressBar x:Name="progressBar" Height="9" VerticalAlignment="Top" Margin="0,11,4,0" Value="{Binding CurrentReading.eSenseAttention, RelativeSource={RelativeSource TemplatedParent}}" Foreground="#FFE51400" RenderTransformOrigin="0.5,0.5" Grid.ColumnSpan="2" Grid.Row="2">
                    		<ProgressBar.RenderTransform>
                    			<CompositeTransform ScaleY="2"/>
                    		</ProgressBar.RenderTransform>
                    	</ProgressBar>
                    	<TextBlock HorizontalAlignment="Left" Margin="0" Style="{StaticResource PhoneTextExtraLargeStyle}" TextWrapping="Wrap" Text="eSense Attention" VerticalAlignment="Top" Width="470" Height="57" Grid.RowSpan="2" Grid.ColumnSpan="2"/>
                    	<TextBlock HorizontalAlignment="Left" Margin="0" Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" VerticalAlignment="Top" Height="106" Width="470" Grid.Row="3" Grid.ColumnSpan="2">
                    		<Run Text="* Hold a single thought"/>
                    		<LineBreak/>
                    		<Run Text="* Count back from 100"/>
                    		<LineBreak/>
                    		<Run Text="* Sing a song silently"/>
                    		<LineBreak/>
                    		<Run Text="* Stare at a specific object"/>
                    	</TextBlock>
                    	<Ellipse x:Name="ellipse" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="24" StrokeThickness="0" RenderTransformOrigin="0.674,0.549" Margin="324,3,0,0" Grid.Row="2" Fill="#FFE51400" Stroke="Black" Grid.ColumnSpan="2"/>
                    	<TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Left" Height="26" Margin="0,2,0,0" Grid.Row="1" Style="{StaticResource PhoneTextSubtleStyle}" TextWrapping="Wrap" Text="Intensity of your mental “focus” or “attention”" VerticalAlignment="Top" Width="470"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:MindwaveConnectButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MindwaveConnectButton">
                    <Grid >
                    	<VisualStateManager.VisualStateGroups>
                    		<VisualStateGroup x:Name="ConnectionStates">
                    			<VisualStateGroup.Transitions>
                    				<VisualTransition GeneratedDuration="0"/>
                    			</VisualStateGroup.Transitions>
                    			<VisualState x:Name="Connected" >
                    				<Storyboard>
                    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ConnectButton">
                    						<DiscreteObjectKeyFrame KeyTime="0">
                    							<DiscreteObjectKeyFrame.Value>
                    								<Visibility>Collapsed</Visibility>
                    							</DiscreteObjectKeyFrame.Value>
                    						</DiscreteObjectKeyFrame>
                    					</ObjectAnimationUsingKeyFrames>
                    					<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ConnectButton" d:IsOptimized="True"/>
                    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DisconnectButton">
                    						<DiscreteObjectKeyFrame KeyTime="0">
                    							<DiscreteObjectKeyFrame.Value>
                    								<Visibility>Visible</Visibility>
                    							</DiscreteObjectKeyFrame.Value>
                    						</DiscreteObjectKeyFrame>
                    					</ObjectAnimationUsingKeyFrames>
                    					<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisconnectButton" d:IsOptimized="True"/>
                    				</Storyboard>
                    			</VisualState>
                    			<VisualState x:Name="Disconnected">
                    				<Storyboard>
                    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ConnectButton">
                    						<DiscreteObjectKeyFrame KeyTime="0">
                    							<DiscreteObjectKeyFrame.Value>
                    								<Visibility>Visible</Visibility>
                    							</DiscreteObjectKeyFrame.Value>
                    						</DiscreteObjectKeyFrame>
                    					</ObjectAnimationUsingKeyFrames>
                    					<DoubleAnimation Duration="0" To="0.995" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ConnectButton" d:IsOptimized="True"/>
                    					<DoubleAnimation Duration="0" To="0.025" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="DisconnectButton" d:IsOptimized="True"/>
                    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="DisconnectButton">
                    						<DiscreteObjectKeyFrame KeyTime="0">
                    							<DiscreteObjectKeyFrame.Value>
                    								<Visibility>Collapsed</Visibility>
                    							</DiscreteObjectKeyFrame.Value>
                    						</DiscreteObjectKeyFrame>
                    					</ObjectAnimationUsingKeyFrames>
                    				</Storyboard>
                    			</VisualState>
                    		</VisualStateGroup>
                    	</VisualStateManager.VisualStateGroups>
                    	<Button x:Name="ConnectButton" Content="Connect"/>
                    	<Button x:Name="DisconnectButton" Content="Disconnect" Visibility="Collapsed" Opacity="0"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:MindwaveMeditationProgressBar">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MindwaveMeditationProgressBar">
					<Grid >
                    	<Grid.RowDefinitions>
                    		<RowDefinition Height="55"/>
							<RowDefinition Height="30"/>
                    		<RowDefinition Height="31"/>
                    		<RowDefinition Height="76*" />
                    	</Grid.RowDefinitions>
                    	<Grid.ColumnDefinitions>
                    		<ColumnDefinition Width="70*"/>
                    		<ColumnDefinition Width="30*"/>
                    	</Grid.ColumnDefinitions>
                    	<VisualStateManager.VisualStateGroups>
                    		<VisualStateGroup x:Name="eSenseStates">
                    			<VisualState x:Name="On">
                    				<Storyboard>
                    					<ColorAnimation Duration="0" To="#FF5FAF4A" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/>
                    					<ColorAnimation Duration="0" To="#FF5FAF4A" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="progressBar" d:IsOptimized="True"/>
                    				</Storyboard>
                    			</VisualState>
                    			<VisualState x:Name="Off"/>
                    		</VisualStateGroup>
                    	</VisualStateManager.VisualStateGroups>
                    	<ProgressBar x:Name="progressBar" Height="9" VerticalAlignment="Top" Margin="0,11,4,0" Value="{Binding CurrentReading.eSenseMeditation, RelativeSource={RelativeSource TemplatedParent}}" Foreground="#FFE51400" RenderTransformOrigin="0.5,0.5" Grid.ColumnSpan="2" Grid.Row="2">
                    		<ProgressBar.RenderTransform>
                    			<CompositeTransform ScaleY="2"/>
                    		</ProgressBar.RenderTransform>
                    	</ProgressBar>
                    	<TextBlock HorizontalAlignment="Left" Margin="0" Style="{StaticResource PhoneTextExtraLargeStyle}" TextWrapping="Wrap" Text="eSense Meditation" VerticalAlignment="Top" Width="470" Height="57" Grid.RowSpan="2" Grid.ColumnSpan="2"/>
                    	<TextBlock HorizontalAlignment="Left" Margin="0" Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" VerticalAlignment="Top" Height="106" Width="470" Grid.Row="3" Grid.ColumnSpan="2">
                    		<Run Text="* Relax"/>
                    		<LineBreak/>
                    		<Run Text="* Close your eyes"/>
                    		<LineBreak/>
                    		<Run Text="* Deep breaths and slowly exhale"/>
                    		<LineBreak/>
                    		<Run Text="* Clear your mind of thoughts"/>
                    	</TextBlock>
                    	<Ellipse x:Name="ellipse" HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="24" StrokeThickness="0" RenderTransformOrigin="0.674,0.549" Margin="324,3,0,0" Grid.Row="2" Fill="#FFE51400" Stroke="Black" Grid.ColumnSpan="2"/>
                    	<TextBlock Grid.ColumnSpan="2" HorizontalAlignment="Left" Height="31" Margin="0,2,0,0" Grid.Row="1" Style="{StaticResource PhoneTextSubtleStyle}" TextWrapping="Wrap" Text="Indicates your mental &quot;calmness&quot; or &quot;relaxation&quot;" VerticalAlignment="Top" Width="470" Grid.RowSpan="2"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:MindwaveConnectionIndicator">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MindwaveConnectionIndicator">
                	<Grid >
                		<VisualStateManager.VisualStateGroups>
                			<VisualStateGroup x:Name="ConnectionStates">
                				<VisualStateGroup.Transitions>
                					<VisualTransition GeneratedDuration="0:0:0.3"/>
                				</VisualStateGroup.Transitions>
                				<VisualState x:Name="NotConnected"/>
                				<VisualState x:Name="Connecting">
                					<Storyboard>
                						<ColorAnimation Duration="0" To="#FF0D319C" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/>
                						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="textBlock">
                							<DiscreteObjectKeyFrame KeyTime="0" Value="Connecting..."/>
                						</ObjectAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="ConnectedWithNoDataYet">
                					<Storyboard>
                						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="textBlock">
                							<DiscreteObjectKeyFrame KeyTime="0" Value="Connecting..."/>
                						</ObjectAnimationUsingKeyFrames>
                						<ColorAnimation Duration="0" To="#FF0D319C" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="ConnectedWithUnreliableData">
                					<Storyboard>
                						<ColorAnimation Duration="0" To="#FF8E9C0D" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/>
                						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="textBlock">
                							<DiscreteObjectKeyFrame KeyTime="0" Value="Unreliable data"/>
                						</ObjectAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="ConnectedWithData">
                					<Storyboard>
                						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="textBlock">
                							<DiscreteObjectKeyFrame KeyTime="0" Value="Connected"/>
                						</ObjectAnimationUsingKeyFrames>
                						<ColorAnimation Duration="0" To="#FF209C0D" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="ellipse" d:IsOptimized="True"/>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="FailedConnection">
                					<Storyboard>
                						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="textBlock">
                							<DiscreteObjectKeyFrame KeyTime="0" Value="Connection failed"/>
                						</ObjectAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="FailedDuringExecution">
                					<Storyboard>
                						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="textBlock">
                							<DiscreteObjectKeyFrame KeyTime="0" Value="Connection failed"/>
                						</ObjectAnimationUsingKeyFrames>
                					</Storyboard>
                				</VisualState>
                			</VisualStateGroup>
                		</VisualStateManager.VisualStateGroups>
                		<Ellipse Width="28" x:Name="ellipse" Fill="#FF9C0D0D" HorizontalAlignment="Left" Height="28" Stroke="Black" VerticalAlignment="Top" StrokeThickness="0" Margin="0,10,0,0" />
                		<TextBlock x:Name="textBlock" HorizontalAlignment="Left" Margin="37,0,0,0" Style="{StaticResource PhoneTextLargeStyle}" TextWrapping="Wrap" Text="Not Connected" VerticalAlignment="Top" />
                	</Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>